package Basepractice.P2017_11_1;

/**
 * Created by Administrator on 2017/11/1.
 */
//分别用for语句、while语句、do while语句编写程序：求1至n之间能被m整除的整数之和
public class For {
    public static void main(String[] args) {
        int n,m;
        n=10;
        m=5;
        int i=0;
        long sum=0;
        for (i=1;i<=n;i++){
            if (i%m==0){
                sum=sum+i;
            }
        }
        System.out.println("和为"+sum);
    }
}
